﻿using StartEAS_API.Utils;
using StartsEAS_API.Model;
using StartsEAS_API.Model.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StartsEAS_API.DAL.PositionInD
{
    public class PositionInDAL
    {
        private readonly StarsEASContext _context;
        public PositionInDAL(StarsEASContext context) { 
            _context = context;
        }

        public ResultUtils GetAllPositionIn() {
            StarsEASContext _context = new StarsEASContext();
            List<PositionIn> positionsList = _context.PositionIns.ToList();
            if (positionsList == null)
            {
                AppLog.WriteError($"查询职位信息---未查询到职位信息", true);
                return new ResultUtils() { code = 500, message = "未查询到职位信息" };
            }
            AppLog.WriteInfo($"查询职位信息---查询到{positionsList.Count()}条职位信息", true);
            return new ResultUtils() { code = 200, message = positionsList };
        }
    }
}
